package com.example.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.example.demo.utilServcie.RedisService;

@Controller
public class RedisController {

	@Autowired
	private RedisService RedisService;

	@RequestMapping("setRedis")
	@ResponseBody
	public void setRedis() {
		RedisService.setex("hh", 60 * 2, "老包是个大帅哥");
	}

	@RequestMapping("getRedis")
	@ResponseBody
	public String getRedis() {
		String string = RedisService.get("hh");
		System.out.println(string);
		return string;
	}

}
